﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PersonMessage
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Init(object sender,EventArgs e)
        {
            if (!IsPostBack)
            {
                Province.Items.Add("福建");
                Province.Items.Add("山东");
                Province.Items.Add("江西");
                Downtown.Items.Add("龙岩");
                Downtown.Items.Add("厦门");
                Downtown.Items.Add("泉州");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Province.SelectedItem.Text == "福建")
            {
                Downtown.Items.Add("龙岩");
                Downtown.Items.Add("厦门");
                Downtown.Items.Add("泉州");
            }
            else if (Province.SelectedItem.Text == "山东")
            {
                Downtown.Items.Add("潍坊");
                Downtown.Items.Add("临沂");
                Downtown.Items.Add("菏泽");
            }
            else
            {
                Downtown.Items.Add("南昌");
                Downtown.Items.Add("九江");
                Downtown.Items.Add("鄱阳");
            }
        }

        protected void TextBox1_TextChanged(object sender, EventArgs e)
        {

        }

        protected void Upload_Click(object sender, EventArgs e)
        {
            string habbits = "爱好有";
            for (int i = 0; i < Habbits.Items.Count; i++)
            {
                if (Habbits.Items[i].Selected)
                {
                    habbits += Habbits.Items[i].Text + "  ";
                }
            }
            Literal1.Text = $"姓名：{Name.Text} ，性别：{Gender.Text}，来自{Province.Text}{Downtown.Text}市，{habbits}，其他信息{TextBox1.Text}";

            if (FileUpload1.HasFile)
            {
                string fileName = FileUpload1.FileName;
                FileUpload1.SaveAs(fileName);
                GetImage.ImageUrl = "/img/"+fileName;
                GetImage.Visible = true;
            }
        }
    }
}